package bitcarve.hydra.ui.timeline.render
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class SimpleColorTrackRender extends TrackRender implements ITrackRender
	{
		
		public var color:uint = 0xffffff;
		
		private var canvas:Sprite;
		private var outline:Sprite;
		
		public function SimpleColorTrackRender()
		{
			super();
			this.buttonMode = true;
			
			canvas = new Sprite();
			render();
			this.addChild(canvas);
			
			outline = new Sprite();
			outline.graphics.clear();
			outline.graphics.lineStyle(0, 0xffffff);
			outline.graphics.drawRect(0, 0, this.width, this.height);
			
			this.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
			this.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
		}
		
		public function render():void
		{
			canvas.graphics.clear();
			canvas.graphics.beginFill(color, 1);
			canvas.graphics.drawRect(0, 0, 100, 10);
			canvas.graphics.endFill();
		}
		
		private function overHandler(event:MouseEvent):void
		{
			this.addChild(outline);
		}
		
		private function outHandler(event:MouseEvent):void
		{
			this.removeChild(outline);
		}
		
	}
}